<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/fuman/js/oversea.js"></script>
<title>运输计划列表｜海外仓管理</title>
<script type="text/javascript">

	/********增加多行上传附件*******************/
var totalnum = 1;
function showinput(t)
{
	var inputn = document.getElementById(t);
	var str=inputn.innerHTML;
	var num=1;
	for(var i=1;i<=num;i++){
		totalnum=totalnum+i;
		str += "<tr id=las"+totalnum+">";
		str+="<td>上传：</td>";
        str+="<td><input type=\"file\" name=\"userfile["+totalnum+"]\" id=\"userfile"+totalnum+"\"  style=\"height:25px;\"/>&nbsp;&nbsp;<a href=javascript:void(0) onclick=delfileinput("+totalnum+")><span style=\"padding:5px 0 0\" class=\"c9\">移除</span></a></td>";
        str+="</tr>";
	}
	$("#"+t).html(str);
	
}
function addattribute(id,t)
{
		$("#tpid").val(id);
		
		 $.post("/oversea/ajaxbutton", {"op": "getfile", "tpid": id},
		  function (data) {
          
           	var tmp='<br><table cellpadding="0" cellspacing="0" border="0" class="stdtable">';
				tmp+='<thead><th class="head0">移除</th><th class="head0">名称</th><th class="head0">下载</th></tr> </thead>';
				for(var i=0;i<data.length;i++)
				{
					if(data[i].createUser=='{{$username}}')
					{
						var delstr = "<img src=/fuman/images/del.png class=p_del  style=\"cursor:pointer\" title=\"不需要这个附件\" onclick=\"delattfile("+data[i].id+",this)\">";	
					}else{
						var delstr = '';	
					}
					tmp+=" <tr>";
					tmp +="<td>"+delstr+"</td><td>"+data[i].filename+"</td><td><a href=/"+data[i].local_url+" target=_thank>点击下载</a></td>" ;
					tmp+=" </tr>";
				}
				tmp+="</table>";
    		      $("#filelist").html(tmp); 

        }, "json");
		
		
		
				/*
			   */
	if(t==0)
	{
		$("#shoupfile").show();	
	}else{
		$("#shoupfile").hide();	
		}
	 
	$('#addattributeform').modal('show');	
}
function delattfile(id)
{
		 $.post("/oversea/ajaxbutton", {"op": "delattfile", "id": id},
		  function (data) {
          	if(data==201)
			{
				alert("不允许删除其他人上传的附件！");
				return;
			}
			if(data==200)
			{
				alert("删除成功！请刷新页面");
				return;
			}
			
        }, "json");
}
function changother()
{
	$("#other").val('');	
}
</script>
<body class="withvernav">
<div class="bodywrapper">
{{include file='/public/leftmenu.tpl'}}
<div class="centercontent tables">
  <div class="pageheader notab">
    <h1 class="pagetitle">运输计划列表</h1>
    <span class="pagedesc"></span>
            <div class="menulist">
        		<ul class="profile_summary">
                        <li class="current"><a href="/oversea/deliveryplan">运输计划</a></li>
                        
                    </ul>
               </div> </div>
  <!--pageheader-->
  
  <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
  <div id="contentwrapper" class="contentwrapper"> 
    <!--搜索栏-->
    <form class="stdform stdform2" method="get" action="/oversea/deliveryplanlist">
      <div class="tableoptions"> 操作时间：
        <input type="text"  name="starttime" value="{{$starttime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" /> - <input type="text"  name="endtime" value="{{$endtime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" />
       
        <select name="st" class="selection" style="width:100px;" onChange="changother()">
            <option value="1" {{if $st=="1"}} selected{{/if}}>计划编号</option>
            <option value="2" {{if $st==2}} selected{{/if}}>商品编号</option>
            <option value="3" {{if $st==3}} selected{{/if}}>调拨编号</option>
             </select>
       <input type="text" name="other" id="other" class="width100" value="{{$other}}" />
        状态:
            <select name="status" class="selection" style="width:100px;">
            <option value="" {{if $status==""}} selected{{/if}}>请选择</option>
            <option value="1" {{if $status==1}} selected{{/if}}>新创建</option>
            <option value="2" {{if $status==2}} selected{{/if}}>一审通过</option>
            <option value="3" {{if $status==3}} selected{{/if}}>二审通过</option>
            <option value="4" {{if $status==4}} selected{{/if}}>封箱完成</option>
            <option value="5" {{if $status==5}} selected{{/if}}>运输完成</option>
            <option value="6" {{if $status==6}} selected{{/if}}>未上传PDF</option>
            </select>
         &nbsp;
         始发地
          <select name="starthouse" id="starthouse" class="selection select2_group" style="width:200px;">
                            	 <option value="" >请选择</option>
                               {{foreach from=$overseawarehouse item=li key=key}}
                               		 <option value="{{$li.name}}" {{if $li.name==$starthouse}} selected{{/if}}  >{{$li.name}}</option>
                               {{/foreach}}
                            </select>
                          
           &nbsp;运输方式 <select class="selection" id="transportmode" name="transportmode" >
                <option value="">-请选择-</option>
                
						    	 {{foreach from=$transportmodelist item=li key=key}}
					    			
                <option value="{{$li}}" {{if $transportmode==$li}} selected{{/if}}>{{$li}}</option>
                
					  	     	{{/foreach}}
									
              </select>                
        &nbsp;
        目的地：
        <select name="endhouse" id="endhouse" class="selection select2_group" style="width:200px;">
                            	 <option value="" >请选择</option>
                               {{foreach from=$overseawarehouse item=li key=key}}
                               		{{if $myseawarehouse}}
                               		  {{if in_array($li.name,$myseawarehouse)}} 
                               			 <option value="{{$li.name}}" {{if $endhouse==$li.name}} selected{{/if}} >{{$li.name}}</option>
                                	  {{/if}}
                                    {{else}}
                               			 <option value="{{$li.name}}"{{if $endhouse==$li.name}} selected{{/if}} >{{$li.name}}</option>
                                    {{/if}}
                               {{/foreach}}
                            </select>
                             &nbsp;
        店 铺:
        <select name="shopname" id="shopname"  class="selection select2_group" style="width:150px;">
                             <option value="" >请选择</option>
                               {{foreach from=$d_shop item=li key=key}}
                              	 {{if $myshopname}}
                                     {{if in_array($li.name,$myshopname)}} 
                                     <option value="{{$li.name}}" {{if $shopname==$li.name}} selected{{/if}} >{{$li.name}}</option>
                                     {{/if}}
                                 {{else}}
                                 	  <option value="{{$li.name}}" {{if $shopname==$li.name}} selected{{/if}} >{{$li.name}}</option>
                                 {{/if}}
                               {{/foreach}}
                            </select>
                          经办人:
        <select name="user" id="user"  class="selection select2_group" style="width:150px;">
                             <option value="" >请选择</option>
                               {{foreach from=$userlist item=li key=key}}
                              	
                                 	  <option value="{{$li.name}}" {{if $usernamedispname==$li.name}} selected{{/if}} >{{$li.name}}</option>
                               
                               {{/foreach}}
                            </select>
        <button class="radius3">Search</button>
      
      {{if $allnowbuynum}}
       <br> <font color="#FF0000"> {{$allnowbuynum}}</font>
      {{/if}}
      </div>
    </form>
    <!--搜索栏结束-->
    <div class="x_content" style="overflow-x:auto;">
    <table cellpadding="0" cellspacing="0" border="0" class="stdtable" width="100%">
      <colgroup>
      <col class="con1" />
      <col class="con0" />
      <col class="con1" />
      <col class="con0" />
      <col class="con1" />
      <col class="con0" />
      <col class="con1" />
      </colgroup>
      <thead>
        <tr>
          <th class="head0">运输计划编号</th>
          <th class="head0">状态</th>
          <th class="head0">始发地</th>
          <th class="head1">目的地</th>
          <th class="head0">店铺</th>
       
          <th class="head0">运输方式</th>
          <th class="head0">承运人</th>
          <th class="head0">SKU数</th>
          <th class="head0">总数量</th>
          <th class="head0">商品成本</th>
          <th class="head0">经办人</th>
          <th class="head0">创建时间</th>
          <th class="head0">操作</th>
        </tr>
      </thead>
      <tbody>
      
      {{foreach from=$list item=li key=key}}
      <tr>
        <td>{{$li.groupid}}&nbsp;&nbsp;&nbsp;<a href="/oversea/showplandetail/{{$li.id}}/1" target="_blank"><img src="/fuman/images/csv.png"></a>
        {{if $li.upfiles}}
        <a href="{{$li.upfiles}}" target="_blank" title="FBA标签"><img src="/fuman/images/icons/content.png"></a>&nbsp;
        {{/if}}
        {{if $li.isfile}}
         <a href="javascript:void(0)" onClick="addattribute({{$li.id}},1)"><img src="/fuman/images/icons/ebaynote.png"></a>&nbsp;
        {{/if}}
        </td>
        <td>
        {{if $li.status==1}} 新创建{{/if}}
        {{if $li.status==2}} 一审通过{{/if}}
        {{if $li.status==22}} 一审不通过{{/if}}
       	{{if $li.status==3}} 二审通过{{/if}}
        {{if $li.status==33}} 二审不通过{{/if}}
        	{{if $li.status==4}}已封箱{{/if}}
            {{if $li.status==5}}运输完成{{/if}}
             {{if $li.status==6}}取消计划{{/if}}
             {{if $li.status==7}}待上传{{/if}}
             {{if $li.status==8}}已发运{{/if}}
        </td>
        <td>{{$li.startingplace}}</td>
        <td>{{$li.destination}}</td>
        <td class="center">
       
        	{{$li.shopname}}
       
       
        </td>
      
        <td class="center">{{$li.transportmode}}</td>
        <td class="center">{{$li.carrier}}</td>
        <td class="center">{{$li.skunum}}</td>
        <td class="center">{{$li.totalnum}}</td>
        <td class="center">{{$li.totalamount}}</td>
        <td class="center">{{$li.createoper}}</td>
          <td class="center">{{$li.createtime}}</td>
        <td class="center">
       
          <a href="/oversea/showplandetail/{{$li.id}}" target="_blank">查看</a> 
       
         
        {{if $li.status==1 || $li.status==7 && ($li.mod==1 || $department ==1 || $department==2)}}
        |  <a href="/oversea/editshowplan/{{$li.id}}" target="_blank">编辑</a>  | <a href="javascript:void(0)" onClick="deliveryplanlist({{$li.id}})">删除</a>
        
        |  <a href="javascript:void(0)" onClick="addattribute({{$li.id}},0)"><span>上传</span></a> 
        {{/if}}
        
        {{if $li.status==22 && ($li.mod==1 || $department ==1 || $department==2)}}
       | <!--<a href="/oversea/editshowplan/{{$li.id}}" >编辑</a>  |--> <a href="javascript:void(0)" onClick="deliveryplanlist({{$li.id}})">删除</a>
        {{/if}}
         {{if $li.status==33 && ($li.mod==1 || $department ==1 || $department==2)}}
       |  <!--<a href="/oversea/editshowplan/{{$li.id}}" >编辑</a>  |--> <a href="javascript:void(0)" onClick="deliveryplanlist({{$li.id}})">删除</a>
        {{/if}}
        
        
        
        {{if $li.status==2 && ($department ==1 || $department==2)}}
       | <a href="javascript:void(0)" onClick="deliveryplanlist({{$li.id}})">删除</a> 
        {{/if}}
        
         {{if $li.status==3 && $li.mods==1}}
        |  <a href="/oversea/compare/{{$li.id}}" target="_blank">封箱</a>  | <a href="javascript:void(0)" onClick="changstatus(4,{{$li.id}},1)">封箱完成</a> | <a href="javascript:void(0)" onClick="changstatus(6,{{$li.id}},1)">取消计划</a> 
        {{/if}}
        
        {{if $li.status==3 || $li.status==2}}
        	| <a href="javascript:void(0)" onClick="addattribute({{$li.id}},0)"><span>上传</span></a> 
        {{/if}}
        
        
        
         {{if $li.status==4 && ($department ==2 || department ==1)}}
         | <a href="javascript:void(0)" onClick="changstatus(8,{{$li.id}},1)">取消完成</a>
        {{/if}}
        </td>
      </tr>
      {{/foreach}}
        </tbody>
      
    </table>
    </div>
    <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
    <br />
    <br />
  </div>
</div>
<!--bodywrapper-->
<!-- 模态框（Modal）添加 -->
<form action="/oversea/ajaxbutton?op=savefile" enctype="multipart/form-data"  method="post" name="otherformst" id="otherformst" >
<input type="hidden" name="tpid" id="tpid">
  <div class="modal fade" id="addattributeform" tabindex="-1" role="dialog" aria-labelledby="returnaddattributeform" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="returnaddattributeform"> 上传(pdf rar zip) </h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0" id="shoupfile">
            <tr>
              <td>上传： </td>
              <td align="left"><input type="file" name="userfile[1]" id="userfile1" /> <a href="javascript:void(0)"  onClick="showinput('fileinput')" class="btn btn_book"><span>添加</span></a></td>
            </tr>
            <tbody id="fileinput"></tbody>
          
          </table>
          <div id="filelist"></div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="AWSsubmit('otherformst','addattributeform')"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
</form>
<!-- 模态框（Modal）添加商品图片 -->
</body>
</html>